/*
 * syscalls.c
 *
 *  Created on: 2013. 7. 16.
 *      Author: Shim
 */

/* Includes ------------------------------------------------------------------*/
#include <errno.h>
#include <sys/stat.h>
#include <sys/times.h>
#include <sys/unistd.h>
#include <sys/types.h>

/* Exported variables --------------------------------------------------------*/
extern int __HEAP_START;

/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/



/* Private functions ---------------------------------------------------------*/
/**
  * @brief   _sbrk program
  * @param  incr
  * @retval caddr_t
  */
caddr_t _sbrk (int incr)
{
	static unsigned char *heap = NULL;
	unsigned char *prev_heap;

	if(heap == NULL) {
		heap = (unsigned char *)&__HEAP_START;
	}

	prev_heap = heap;

	/* check removed to show basic approach */

	heap += incr;
	return (caddr_t) prev_heap;
}


